import { ref, computed } from 'vue'

export function useTableDetail(column) {
  const detailExcept = ['detail', 'edit', 'delete', 'operate']
  // 弹窗控制
  const dialogVisible = ref(false);
  const currentItem = ref({});
  // 打开详情弹窗
  const openDetail = (row) => {
    currentItem.value = { ...row };
    dialogVisible.value = true;
  };
  const detailColumn = computed(() => column.filter(item => !detailExcept.includes(item.prop)))

  // 通过返回值暴露所管理的状态
  return { dialogVisible, currentItem, openDetail, detailColumn }
}